package com.ws.common.result.entity;

import lombok.Data;

@Data
public class ResultEntity {

    public static String SUCCES="200";

    /**
     * 错误码
     */
    private String code;

    /**
     * 提示信息
     */
    private String msg;

    /**
     * 具体的内容
     */
    private Object data;

    ResultEntity(){

    }
    ResultEntity(String code){
        this.code=code;
    }

    public static ResultEntity succes( Object data){
        ResultEntity resultEntity=new ResultEntity(ResultEntity.SUCCES);
        resultEntity.setData(data);
        return resultEntity;
    }

    public static ResultEntity error( String code,Object data){
        ResultEntity resultEntity=new ResultEntity(ResultEntity.SUCCES);
        resultEntity.setData(data);
        resultEntity.setCode(code);
        return resultEntity;
    }

    public static ResultEntity error( Object data){
        ResultEntity resultEntity=new ResultEntity(ResultEntity.SUCCES);
        resultEntity.setData(data);
        resultEntity.setCode("500");
        return resultEntity;
    }
}
